package com.hexb.smh.entity.view;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;

/**
 * @author : hexb
 * 提供给业务员端的项目显示,隐藏敏感信息
 */
@Data
public class ProductClientView {
    final static private DecimalFormat f = new DecimalFormat("0.00");

    private Integer id;

    @ApiModelProperty("项目名称")
    private String name;

    @ApiModelProperty("项目编号,全系统唯一")
    private String itemNo;

    @ApiModelProperty("项目简码")
    private String briefCode;

    @ApiModelProperty("市场价")
    @JsonIgnore
    private BigDecimal marketPrice;

    @ApiModelProperty("描述,业务员可见")
    private String description;

    @ApiModelProperty("分类")
    private String category;

    @ApiModelProperty("已格式化的价格")
    public String getPrice() {
        if (null != marketPrice) {
            return f.format(marketPrice);
        }
        return null;
    }
}
